home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 742 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solon.com (Peter Seebach)
  3. Newsgroups: comp.std.c,comp.lang.c.moderated
  4. Subject: Re: printf() format extensions - looking for beta testers...
  5. Date: 14 Apr 1996 23:43:54 -0500
  6. Organization: Usenet Fact Police (Undercover)
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4ksk6a$rl5@solutions.solon.com>
  10. References: <4kgljv$l2p@solutions.solon.com> <4klicn$ndl@solutions.solon.com> <4kr78t$kao@solutions.solon.com>
  11. Reply-To: seebs@solon.com
  12. NNTP-Posting-Host: solutions.solon.com
  13.  
  14. In article <4kr78t$kao@solutions.solon.com>,
  15. Casper H.S. Dik - Network Security Engineer <Casper.Dik@Holland.Sun.COM> wrote:
  16. >Yes, it seems that the format call back function (bangcvt) should take
  17. >a number of flags (leading 0/- found, precision, maximum width) and
  18. >a generic way to make the user defined format specifier output characters,
  19. >as it can be called from functions like "snprintf", which limit the output.
  20. >Passing a buffer to but the output in doesn't strike me as sufficient;
  21. >if "bangcvt" can have unlimited output, it must be possible for the
  22. >mechanism to cater for that.
  23.  
  24. But, of course, the current language only guarantees up to 509 characters.
  25.  
  26. It does get the flags; a fmtspec is a struct containing those and other
  27. info.
  28.  
  29. >And, of course, you want a input conversion as well :-)
  30.  
  31. Still working on that.
  32.  
  33. >So instead of:
  34.  
  35. >You'd get something more like:
  36.  
  37. >    bangcvt (va_list *ap, int flags, int width, int precision,
  38. >    char fmt, int (*putit)(char c, void *output), void *output)
  39.  
  40. >(Where you call "putit" for each character of output with *output
  41. >as magic for the call back)
  42.  
  43. The problem is that function calls tend to be expensive.  The flags,
  44. width, and precision are already in the fmtspec *.
  45.  
  46. -s
  47. -- 
  48. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  49. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  50. FUCK the communications decency act.  Goddamned government.  [literally.]
  51. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  52.